<?php
namespace app\app\controller\v1;
use think\Request;
use think\Controller;
use app\app\util\OnlineUtils;

class BaseController extends Controller{

	public function _initialize()
	{
        $request = Request::instance();
        $header = $request->header();
        $accessActionArr = array('login','UserCenter','notifyUrl');
        if($request->isOptions()){
            echo '{"code":200,"message":"options","data":""}';
            die(0);
        }
        if(in_array($request->action(),$accessActionArr)){

        }else{
            if(!empty($header['token'])){
                if(OnlineUtils::requestIsLogin()){

                }else{
                    header( 'content-type: application/json; charset=utf-8');
                    echo '{"code":500,"message":"未登录","data":""}';
                    die(0);                    
                }
            }else{
                header( 'content-type: application/json; charset=utf-8');
                echo '{"code":500,"message":"not access","data":""}';
                die(0);
            }
        }		
	}
	
}